<!DOCTYPE html>
<html lang=zh>
<head>
  <meta charset="utf-8">
  
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-transform" />
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="format-detection" content="telephone=no,email=no,adress=no">
  <!-- Color theme for statusbar -->
  <meta name="theme-color" content="#000000" />
  <!-- 强制页面在当前窗口以独立页面显示,防止别人在框架里调用页面 -->
  <meta http-equiv="window-target" content="_top" />
  
  
  <title>将Java程序打包为exe文件并和jre一起打包为安装包 | 张占阳的博客</title>
  <meta name="description" content="1.将Java程序导出的jar文件打包为exe文件1.1打开安装好的exe4j软件，首先看到的是一个欢迎界面，直接【next】就可以了   1.2在第二步中我们选择【JAR in EXE mode】，然后【next】   1.3.第三步中需要输入程序的缩写名字和指明输出目录，就是程序的保存目录，按照自己的情况设置就行，没啥特别要求，然后【next】   1.4.需要指定程序的名字，设置程序的图标，">
<meta property="og:type" content="article">
<meta property="og:title" content="将Java程序打包为exe文件并和jre一起打包为安装包">
<meta property="og:url" content="https://zzy521.com/posts/eeae6a0e.html">
<meta property="og:site_name" content="张占阳的博客">
<meta property="og:description" content="1.将Java程序导出的jar文件打包为exe文件1.1打开安装好的exe4j软件，首先看到的是一个欢迎界面，直接【next】就可以了   1.2在第二步中我们选择【JAR in EXE mode】，然后【next】   1.3.第三步中需要输入程序的缩写名字和指明输出目录，就是程序的保存目录，按照自己的情况设置就行，没啥特别要求，然后【next】   1.4.需要指定程序的名字，设置程序的图标，">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://zzy521.com/img/1.png">
<meta property="og:image" content="https://zzy521.com/img/2.png">
<meta property="og:image" content="https://zzy521.com/img/3.png">
<meta property="og:image" content="https://zzy521.com/img/4.png">
<meta property="og:image" content="https://zzy521.com/img/5.png">
<meta property="og:image" content="https://zzy521.com/img/6.png">
<meta property="og:image" content="https://zzy521.com/img/7.png">
<meta property="og:image" content="https://zzy521.com/img/8.png">
<meta property="og:image" content="https://zzy521.com/img/9.png">
<meta property="og:image" content="https://zzy521.com/img/10.png">
<meta property="og:image" content="https://zzy521.com/img/11.png">
<meta property="og:image" content="https://zzy521.com/img/12.png">
<meta property="og:image" content="https://zzy521.com/img/2021-02-19_140259.png">
<meta property="og:image" content="https://zzy521.com/img/QQ截图20210219140645.png">
<meta property="og:image" content="https://zzy521.com/img/QQ截图20210219140927.png">
<meta property="og:image" content="https://zzy521.com/img/QQ截图20210219142039.png">
<meta property="og:image" content="https://zzy521.com/img/QQ截图20210219142521.png">
<meta property="og:image" content="https://zzy521.com/img/QQ截图20210219145453.png">
<meta property="og:image" content="https://zzy521.com/img/QQ截图20210219145541.png">
<meta property="og:image" content="https://zzy521.com/img/QQ截图20210219145557.png">
<meta property="og:image" content="https://zzy521.com/img/QQ截图20210219145610.png">
<meta property="og:image" content="https://zzy521.com/img/QQ截图20210219145922.png">
<meta property="og:image" content="https://zzy521.com/img/QQ截图20210219150133.png">
<meta property="og:image" content="https://zzy521.com/img/QQ截图20210219150217.png">
<meta property="og:image" content="https://zzy521.com/img/QQ%E6%88%AA%E5%9B%BE20210219150416.png">
<meta property="article:published_time" content="2021-02-19T03:36:00.000Z">
<meta property="article:modified_time" content="2021-02-25T09:15:06.169Z">
<meta property="article:author" content="张占阳">
<meta property="article:tag" content="exe">
<meta property="article:tag" content="Java">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://zzy521.com/img/1.png">
  <!-- Canonical links -->
  <link rel="canonical" href="https://zzy521.com/posts/eeae6a0e.html">
  
    <link rel="alternate" href="/atom.xml" title="张占阳的博客" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png" type="image/x-icon">
  
  
<link rel="stylesheet" href="/css/style.css">

  
  
  
  
<meta name="generator" content="Hexo 5.3.0"></head>


<body class="main-center" itemscope itemtype="http://schema.org/WebPage">
  <header class="header" itemscope itemtype="http://schema.org/WPHeader">
  <div class="slimContent">
    <div class="navbar-header">
      
      
      <div class="profile-block text-center">
        <a id="avatar" href="https://github.com/zzy2019520" target="_blank">
          <img class="img-circle img-rotate" src="/images/avatar.jpg" width="200" height="200">
        </a>
        <h2 id="name" class="hidden-xs hidden-sm">张占阳</h2>
        <h3 id="title" class="hidden-xs hidden-sm hidden-md">软件开发工程师</h3>
        <small id="location" class="text-muted hidden-xs hidden-sm"><i class="icon icon-map-marker"></i> 徐州, 中国</small>
      </div>
      
      <div class="search" id="search-form-wrap">

    <form class="search-form sidebar-form">
        <div class="input-group">
            <input type="text" class="search-form-input form-control" placeholder="搜索" />
            <span class="input-group-btn">
                <button type="submit" class="search-form-submit btn btn-flat" onclick="return false;"><i class="icon icon-search"></i></button>
            </span>
        </div>
    </form>
    <div class="ins-search">
  <div class="ins-search-mask"></div>
  <div class="ins-search-container">
    <div class="ins-input-wrapper">
      <input type="text" class="ins-search-input" placeholder="想要查找什么..." x-webkit-speech />
      <button type="button" class="close ins-close ins-selectable" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
    </div>
    <div class="ins-section-wrapper">
      <div class="ins-section-container"></div>
    </div>
  </div>
</div>


</div>
      <button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target="#main-navbar" aria-controls="main-navbar" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
    </div>
    <nav id="main-navbar" class="collapse navbar-collapse" itemscope itemtype="http://schema.org/SiteNavigationElement" role="navigation">
      <ul class="nav navbar-nav main-nav menu-highlight">
        
        
        <li class="menu-item menu-item-home">
          <a href="/.">
            
            <i class="icon icon-home-fill"></i>
            
            <span class="menu-title">首页</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-archives">
          <a href="/archives">
            
            <i class="icon icon-archives-fill"></i>
            
            <span class="menu-title">归档</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-categories">
          <a href="/categories">
            
            <i class="icon icon-folder"></i>
            
            <span class="menu-title">分类</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-tags">
          <a href="/tags">
            
            <i class="icon icon-tags"></i>
            
            <span class="menu-title">标签</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-about">
          <a href="/about">
            
            <i class="icon icon-cup-fill"></i>
            
            <span class="menu-title">关于</span>
          </a>
        </li>
        
      </ul>
      
	
    <ul class="social-links">
    	
        <li><a href="https://github.com/zzy2019520" target="_blank" title="Github" data-toggle=tooltip data-placement=top><i class="icon icon-github"></i></a></li>
        
        <li><a href="https://weibo.com/u/6000361757" target="_blank" title="Weibo" data-toggle=tooltip data-placement=top><i class="icon icon-weibo"></i></a></li>
        
    </ul>

    </nav>
  </div>
</header>

  
    <aside class="sidebar" itemscope itemtype="http://schema.org/WPSideBar">
  <div class="slimContent">
    
      <div class="widget">
    <h3 class="widget-title">公告</h3>
    <div class="widget-body">
        <div id="board">
            <div class="content">
                <p>欢迎交流与分享经验!</p>
            </div>
        </div>
    </div>
</div>

    
      
  <div class="widget">
    <h3 class="widget-title">分类</h3>
    <div class="widget-body">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/Java/">Java</a><span class="category-list-count">3</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Python/">Python</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/">开发工具</a><span class="category-list-count">6</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E6%96%87%E7%AB%A0%E5%88%86%E7%B1%BB/">文章分类</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E6%9C%8D%E5%8A%A1%E5%99%A8/">服务器</a><span class="category-list-count">4</span></li></ul>
    </div>
  </div>


    
      
  <div class="widget">
    <h3 class="widget-title">标签</h3>
    <div class="widget-body">
      <ul class="tag-list" itemprop="keywords"><li class="tag-list-item"><a class="tag-list-link" href="/tags/EOS/" rel="tag">EOS</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Hexo/" rel="tag">Hexo</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Java/" rel="tag">Java</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Linux/" rel="tag">Linux</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Rest%E6%8E%A5%E5%8F%A3/" rel="tag">Rest接口</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/SQLServer/" rel="tag">SQLServer</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Tomcat/" rel="tag">Tomcat</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/a/" rel="tag">a++</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/excel/" rel="tag">excel</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/exe/" rel="tag">exe</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/java/" rel="tag">java</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/markdown/" rel="tag">markdown</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/python/" rel="tag">python</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E4%BD%8D%E8%BF%90%E7%AE%97/" rel="tag">位运算</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E6%95%B0%E6%8D%AE%E5%BA%93/" rel="tag">数据库</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E6%96%87%E7%AB%A0%E6%A0%87%E7%AD%BE/" rel="tag">文章标签</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E7%B1%BB%E5%9E%8B%E8%BD%AC%E6%8D%A2/" rel="tag">类型转换</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E9%92%89%E9%92%89%E6%B6%88%E6%81%AF/" rel="tag">钉钉消息</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E9%A1%B9%E7%9B%AE%E8%AF%B4%E6%98%8E/" rel="tag">项目说明</a><span class="tag-list-count">1</span></li></ul>
    </div>
  </div>


    
      
  <div class="widget">
    <h3 class="widget-title">标签云</h3>
    <div class="widget-body tagcloud">
      <a href="/tags/EOS/" style="font-size: 13.67px;">EOS</a> <a href="/tags/Hexo/" style="font-size: 13px;">Hexo</a> <a href="/tags/Java/" style="font-size: 14px;">Java</a> <a href="/tags/Linux/" style="font-size: 13.67px;">Linux</a> <a href="/tags/Rest%E6%8E%A5%E5%8F%A3/" style="font-size: 13px;">Rest接口</a> <a href="/tags/SQLServer/" style="font-size: 13px;">SQLServer</a> <a href="/tags/Tomcat/" style="font-size: 13.33px;">Tomcat</a> <a href="/tags/a/" style="font-size: 13px;">a++</a> <a href="/tags/excel/" style="font-size: 13px;">excel</a> <a href="/tags/exe/" style="font-size: 13px;">exe</a> <a href="/tags/java/" style="font-size: 13px;">java</a> <a href="/tags/markdown/" style="font-size: 13px;">markdown</a> <a href="/tags/python/" style="font-size: 13px;">python</a> <a href="/tags/%E4%BD%8D%E8%BF%90%E7%AE%97/" style="font-size: 13px;">位运算</a> <a href="/tags/%E6%95%B0%E6%8D%AE%E5%BA%93/" style="font-size: 13px;">数据库</a> <a href="/tags/%E6%96%87%E7%AB%A0%E6%A0%87%E7%AD%BE/" style="font-size: 13px;">文章标签</a> <a href="/tags/%E7%B1%BB%E5%9E%8B%E8%BD%AC%E6%8D%A2/" style="font-size: 13px;">类型转换</a> <a href="/tags/%E9%92%89%E9%92%89%E6%B6%88%E6%81%AF/" style="font-size: 13px;">钉钉消息</a> <a href="/tags/%E9%A1%B9%E7%9B%AE%E8%AF%B4%E6%98%8E/" style="font-size: 13px;">项目说明</a>
    </div>
  </div>

    
      
  <div class="widget">
    <h3 class="widget-title">归档</h3>
    <div class="widget-body">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/05/">五月 2021</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/04/">四月 2021</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/03/">三月 2021</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/02/">二月 2021</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/01/">一月 2021</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/12/">十二月 2020</a><span class="archive-list-count">3</span></li></ul>
    </div>
  </div>


    
      
  <div class="widget">
    <h3 class="widget-title">最新文章</h3>
    <div class="widget-body">
      <ul class="recent-post-list list-unstyled no-thumbnail">
        
          <li>
            
            <div class="item-inner">
              <p class="item-category">
                <a class="category-link" href="/categories/%E6%96%87%E7%AB%A0%E5%88%86%E7%B1%BB/">文章分类</a>
              </p>
              <p class="item-title">
                <a href="/posts/ab81ff07.html" class="title">CRM调用外部接口</a>
              </p>
              <p class="item-date">
                <time datetime="2021-05-18T01:48:01.000Z" itemprop="datePublished">2021-05-18</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-inner">
              <p class="item-category">
                <a class="category-link" href="/categories/%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/">开发工具</a>
              </p>
              <p class="item-title">
                <a href="/posts/6a850357.html" class="title">调用钉钉接口发送工作通知</a>
              </p>
              <p class="item-date">
                <time datetime="2021-04-07T03:21:19.000Z" itemprop="datePublished">2021-04-07</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-inner">
              <p class="item-category">
                <a class="category-link" href="/categories/%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/">开发工具</a>
              </p>
              <p class="item-title">
                <a href="/posts/21754c85.html" class="title">解决NavicatPremium连接SQLServer出现未发现数据源名称并且未指定默认驱动</a>
              </p>
              <p class="item-date">
                <time datetime="2021-03-30T02:34:02.000Z" itemprop="datePublished">2021-03-30</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-inner">
              <p class="item-category">
                <a class="category-link" href="/categories/Java/">Java</a>
              </p>
              <p class="item-title">
                <a href="/posts/dad1e78f.html" class="title">Java中a=a++的问题</a>
              </p>
              <p class="item-date">
                <time datetime="2021-03-23T09:41:17.000Z" itemprop="datePublished">2021-03-23</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-inner">
              <p class="item-category">
                <a class="category-link" href="/categories/Java/">Java</a>
              </p>
              <p class="item-title">
                <a href="/posts/f789481e.html" class="title">Java位运算</a>
              </p>
              <p class="item-date">
                <time datetime="2021-03-23T02:05:47.000Z" itemprop="datePublished">2021-03-23</time>
              </p>
            </div>
          </li>
          
      </ul>
    </div>
  </div>
  

    
  </div>
</aside>

  
  
<aside class="sidebar sidebar-toc collapse" id="collapseToc" itemscope itemtype="http://schema.org/WPSideBar">
  <div class="slimContent">
    <nav id="toc" class="article-toc">
      <h3 class="toc-title">文章目录</h3>
      <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#1-%E5%B0%86Java%E7%A8%8B%E5%BA%8F%E5%AF%BC%E5%87%BA%E7%9A%84jar%E6%96%87%E4%BB%B6%E6%89%93%E5%8C%85%E4%B8%BAexe%E6%96%87%E4%BB%B6"><span class="toc-number">1.</span> <span class="toc-text">1.将Java程序导出的jar文件打包为exe文件</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2-%E5%B0%86jre%E7%8E%AF%E5%A2%83%E5%92%8Cexe%E6%96%87%E4%BB%B6%E4%B8%80%E8%B5%B7%E6%89%93%E5%8C%85%E4%B8%BA%E7%A8%8B%E5%BA%8F%E5%AE%89%E8%A3%85%E5%8C%85"><span class="toc-number">2.</span> <span class="toc-text">2.将jre环境和exe文件一起打包为程序安装包</span></a></li></ol>
    </nav>
  </div>
</aside>

<main class="main" role="main">
  <div class="content">
  <article id="post-将Java程序打包为exe文件并和jre一起打包为安装包" class="article article-type-post" itemscope itemtype="http://schema.org/BlogPosting">
    
    <div class="article-header">
      
        
  
    <h1 class="article-title" itemprop="name">
      将Java程序打包为exe文件并和jre一起打包为安装包
    </h1>
  

      
      <div class="article-meta">
        <span class="article-date">
    <i class="icon icon-calendar-check"></i>
	<a href="/posts/eeae6a0e.html" class="article-date">
	  <time datetime="2021-02-19T03:36:00.000Z" itemprop="datePublished">2021-02-19</time>
	</a>
</span>
        
  <span class="article-category">
    <i class="icon icon-folder"></i>
    <a class="article-category-link" href="/categories/%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/">开发工具</a>
  </span>

        
  <span class="article-tag">
    <i class="icon icon-tags"></i>
	<a class="article-tag-link-link" href="/tags/Java/" rel="tag">Java</a>, <a class="article-tag-link-link" href="/tags/exe/" rel="tag">exe</a>
  </span>


        
	<span class="article-read hidden-xs">
	    <i class="icon icon-eye-fill" aria-hidden="true"></i>
	    <span id="busuanzi_container_page_pv">
			<span id="busuanzi_value_page_pv">0</span>
		</span>
	</span>


        <span class="post-comment"><i class="icon icon-comment"></i> <a href="/posts/eeae6a0e.html#comments" class="article-comment-link">评论</a></span>
        
	
		<span class="post-wordcount hidden-xs" itemprop="wordCount">字数统计: 790(字)</span>
	
	
		<span class="post-readcount hidden-xs" itemprop="timeRequired">阅读时长: 2(分)</span>
	

      </div>
    </div>
    <div class="article-entry marked-body" itemprop="articleBody">
      
        <h2 id="1-将Java程序导出的jar文件打包为exe文件"><a href="#1-将Java程序导出的jar文件打包为exe文件" class="headerlink" title="1.将Java程序导出的jar文件打包为exe文件"></a>1.将Java程序导出的jar文件打包为exe文件</h2><p>1.1打开安装好的exe4j软件，首先看到的是一个欢迎界面，直接【next】就可以了</p>
<img src="../img/1.png" alt="1" style="zoom:67%;" />

<p>1.2在第二步中我们选择【JAR in EXE mode】，然后【next】</p>
<img src="../img/2.png" alt="img" style="zoom:67%;" />

<p>1.3.第三步中需要输入程序的缩写名字和指明输出目录，就是程序的保存目录，按照自己的情况设置就行，没啥特别要求，然后【next】</p>
<img src="../img/3.png" alt="img" style="zoom: 67%;" />

<p>1.4.需要指定程序的名字，设置程序的图标，注意，程序图标要用ico格式的图片</p>
<img src="../img/4.png" alt="img" style="zoom:67%;" />

<p>1.5.然后我们在左边的菜单栏中选择【32 bit or 64 bit】，勾上【Generate 64 bit executeable】，不勾选为32位，勾选为64位</p>
<img src="../img/5.png" alt="img" style="zoom:67%;" />

<p>1.6.添加我们的jar包，点击右边绿色的 “+”号，然后选择【Archive】，打开浏览目录，找到我们的jar包，然后选择【打开】，【ok】</p>
<img src="../img/6.png" alt="img" style="zoom:67%;" />

<img src="../img/7.png" alt="img" style="zoom:67%;" />

<p>1.7.然后选择主类，在Main class后面，选择【浏览】，找到主类，添加上主类，然后【next】</p>
<img src="../img/8.png" alt="img" style="zoom:67%;" />

<img src="../img/9.png" alt="img" style="zoom:67%;" />

<p>1.8.设置JRE的最小最高版本，我们根据自己的情况设置，小版本设置成1.5，大版本设置成1.8，就行</p>
<img src="../img/10.png" alt="img" style="zoom:67%;" />

<p>1.9.然后点击【Advanced Options】，选择【Search sequence】，将我们的JRE添加到软件中，这样的话，我们的代码可以在别的没有安装Java环境的电脑上运行；点击右边的添加，选择【Directory】，然后选择【浏览】，找到我们的JRE，然后添加（添加之后把前面的删掉然后加一个点，这里我写的是.\jre1.8.0_73，使用相对路径，之后把生成的程序和jre的文件夹拷贝到同一个文件夹下）</p>
<img src="../img/11.png" alt="img" style="zoom:67%;" />

<p>1.10.然后点击左侧的【Preferred VM】，选择【Client hotspot VM】，然后【next】</p>
<img src="../img/12.png" alt="img" style="zoom:67%;" />

<p>1.11.其余的步骤直接默认就行了，这样生成的exe文件就能正常运行了！</p>
<h2 id="2-将jre环境和exe文件一起打包为程序安装包"><a href="#2-将jre环境和exe文件一起打包为程序安装包" class="headerlink" title="2.将jre环境和exe文件一起打包为程序安装包"></a>2.将jre环境和exe文件一起打包为程序安装包</h2><p>需要安装<a target="_blank" rel="noopener" href="https://www.baidu.com/link?url=Bejop3spAjw-LqNUd2iZw9OGTAIwdrhK3o32ssHxwdFlOlv6ZNhpIq6IGkNgn1h5vPOIPiEeR1CDMjUMhwF0rK&wd=&eqid=afdafbb7000c18bc00000004602f5369"><em>Inno Setup</em></a></p>
<p>菜单栏→新建，打开脚本向导</p>
<img src="../img/2021-02-19_140259.png" alt="2021-02-19_140259" style="zoom: 50%;" />

<p>直接下一步</p>
<img src="../img/QQ截图20210219140645.png" alt="QQ截图20210219140645" style="zoom: 50%;" />

<p>填写应用程序名称和应用程序版本，其他两个可以选填。</p>
<img src="../img/QQ截图20210219140927.png" alt="QQ截图20210219140927" style="zoom:50%;" />

<p>这一步可以默认，应用程序所在的文件夹默认为上一步填的应用程序名称</p>
<img src="../img/QQ截图20210219142039.png" alt="QQ截图20210219142039" style="zoom:50%;" />

<p>主执行文件选择用exe4j打包好的那个exe文件，然后点击添加文件夹选中jre文件夹，下一步</p>
<img src="../img/QQ截图20210219142521.png" alt="QQ截图20210219142521" style="zoom:50%;" />

<p>直接下一步</p>
<img src="../img/QQ截图20210219145453.png" alt="QQ截图20210219145453" style="zoom:50%;" />

<p>接着下一步</p>
<img src="../img/QQ截图20210219145541.png" alt="QQ截图20210219145541" style="zoom:50%;" />

<p>继续下一步</p>
<img src="../img/QQ截图20210219145557.png" alt="QQ截图20210219145557" style="zoom:50%;" />

<p>还是下一步</p>
<img src="../img/QQ截图20210219145610.png" alt="QQ截图20210219145610" style="zoom:50%;" />

<p>选择安装程序的保存位置、安装程序文件名、安装程序的图标。安装密码为可选项</p>
<img src="../img/QQ截图20210219145922.png" alt="QQ截图20210219145922" style="zoom:50%;" />

<p>继续下一步</p>
<img src="../img/QQ截图20210219150133.png" alt="QQ截图20210219150133" style="zoom:50%;" />

<p>点击完成</p>
<img src="../img/QQ截图20210219150217.png" alt="QQ截图20210219150217" style="zoom:50%;" />

<p>在生成的脚本中找到**[Files]<strong>,然后找到刚刚添加的文件夹路径，在文件加路径后的<code>&#123;app&#125;</code>后边加上<code>\jre</code>，jre就是程序安装后在安装路径下生成的文件夹名称，</strong>这里文件夹的名称与上边1.9中填写的路径要保持一致**，如果上边是跟我的文件夹名一样的，那这里也要写为.\jre1.8.0_73。</p>
<p><img src="../img/QQ%E6%88%AA%E5%9B%BE20210219150416.png" alt="QQ截图20210219150416"></p>
<p>然后在菜单栏点击构建→编译即可。</p>

      
    </div>
    <div class="article-footer">
      <blockquote class="mt-2x">
  <ul class="post-copyright list-unstyled">
    
    <li class="post-copyright-link hidden-xs">
      <strong>本文链接：</strong>
      <a href="https://zzy521.com/posts/eeae6a0e.html" title="将Java程序打包为exe文件并和jre一起打包为安装包" target="_blank" rel="external">https://zzy521.com/posts/eeae6a0e.html</a>
    </li>
    
    <li class="post-copyright-license">
      <strong>版权声明： </strong> 本博客所有文章除特别声明外，均采用 <a href="http://creativecommons.org/licenses/by/4.0/deed.zh" target="_blank" rel="external">CC BY 4.0 CN协议</a> 许可协议。转载请注明出处！
    </li>
  </ul>
</blockquote>


<div class="panel panel-default panel-badger">
  <div class="panel-body">
    <figure class="media">
      <div class="media-left">
        <a href="https://github.com/zzy2019520" target="_blank" class="img-burn thumb-sm visible-lg">
          <img src="/images/avatar.jpg" class="img-rounded w-full" alt="">
        </a>
      </div>
      <div class="media-body">
        <h3 class="media-heading"><a href="https://github.com/zzy2019520" target="_blank"><span class="text-dark">张占阳</span><small class="ml-1x">软件开发工程师</small></a></h3>
        <div>能吃能睡，啥都不会！</div>
      </div>
    </figure>
  </div>
</div>


    </div>
  </article>
  
    
  <section id="comments">
  	
      <div id="vcomments"></div>
    
  </section>


  
</div>

  <nav class="bar bar-footer clearfix" data-stick-bottom>
  <div class="bar-inner">
  
  <ul class="pager pull-left">
    
    <li class="prev">
      <a href="/posts/24cd4f39.html" title="服务器添加EOS的workspace功能"><i class="icon icon-angle-left" aria-hidden="true"></i><span>&nbsp;&nbsp;上一篇</span></a>
    </li>
    
    
    <li class="next">
      <a href="/posts/5a3d390e.html" title="EOS中Restful服务的开发与调用"><span>下一篇&nbsp;&nbsp;</span><i class="icon icon-angle-right" aria-hidden="true"></i></a>
    </li>
    
    
    <li class="toggle-toc">
      <a class="toggle-btn collapsed" data-toggle="collapse" href="#collapseToc" aria-expanded="false" title="文章目录" role="button">
        <span>[&nbsp;</span><span>文章目录</span>
        <i class="text-collapsed icon icon-anchor"></i>
        <i class="text-in icon icon-close"></i>
        <span>]</span>
      </a>
    </li>
    
  </ul>
  
  
  <!-- Button trigger modal -->
  <button type="button" class="btn btn-fancy btn-donate pop-onhover bg-gradient-warning" data-toggle="modal" data-target="#donateModal"><span>赏</span></button>
  <!-- <div class="wave-icon wave-icon-danger btn-donate" data-toggle="modal" data-target="#donateModal">
    <div class="wave-circle"><span class="icon"><i class="icon icon-bill"></i></span></div>
  </div> -->
  
  
  <div class="bar-right">
    
  </div>
  </div>
</nav>
  
<!-- Modal -->
<div class="modal modal-center modal-small modal-xs-full fade" id="donateModal" tabindex="-1" role="dialog">
  <div class="modal-dialog" role="document">
    <div class="modal-content donate">
      <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
      <div class="modal-body">
        <div class="donate-box">
          <div class="donate-head">
            <p>感谢您的支持，我会继续努力的!</p>
          </div>
          <div class="tab-content">
            <div role="tabpanel" class="tab-pane fade active in" id="alipay">
              <div class="donate-payimg">
                <img src="/images/donate/alipay.jpg" alt="扫码支持" title="扫一扫" />
              </div>
              <p class="text-muted mv">扫码打赏，你说多少就多少</p>
              <p class="text-grey">打开支付宝扫一扫，即可进行扫码打赏哦</p>
            </div>
            <div role="tabpanel" class="tab-pane fade" id="wechatpay">
              <div class="donate-payimg">
                <img src="/images/donate/wechat.png" alt="扫码支持" title="扫一扫" />
              </div>
              <p class="text-muted mv">扫码打赏，你说多少就多少</p>
              <p class="text-grey">打开微信扫一扫，即可进行扫码打赏哦</p>
            </div>
          </div>
          <div class="donate-footer">
            <ul class="nav nav-tabs nav-justified" role="tablist">
              <li role="presentation" class="active">
                <a href="#alipay" id="alipay-tab" role="tab" data-toggle="tab" aria-controls="alipay" aria-expanded="true"><i class="icon icon-alipay"></i> 支付宝</a>
              </li>
              <li role="presentation" class="">
                <a href="#wechatpay" role="tab" id="wechatpay-tab" data-toggle="tab" aria-controls="wechatpay" aria-expanded="false"><i class="icon icon-wepay"></i> 微信支付</a>
              </li>
            </ul>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>



</main>

  <footer class="footer" itemscope itemtype="http://schema.org/WPFooter">
	
	
    <ul class="social-links">
    	
        <li><a href="https://github.com/zzy2019520" target="_blank" title="Github" data-toggle=tooltip data-placement=top><i class="icon icon-github"></i></a></li>
        
        <li><a href="https://weibo.com/u/6000361757" target="_blank" title="Weibo" data-toggle=tooltip data-placement=top><i class="icon icon-weibo"></i></a></li>
        
    </ul>

    <div class="copyright">
    	
        &copy; 2021 张占阳
        
        <div class="publishby">
            本网站由<a href="https://www.upyun.com/?utm_source=lianmeng&utm_medium=referral" target="_blank"><img width="40" src="../img/又拍云_logo5.png"/> </a>提供存储服务
        	<!-- Theme by <a href="https://github.com/cofess" target="_blank"> cofess </a>base on <a href="https://github.com/cofess/hexo-theme-pure" target="_blank">pure</a>. -->
        </div>
    </div>
</footer>
  <script src="//cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
<script>
window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')
</script>

<script src="/js/plugin.min.js"></script>


<script src="/js/application.js"></script>


    <script>
(function (window) {
    var INSIGHT_CONFIG = {
        TRANSLATION: {
            POSTS: '文章',
            PAGES: '页面',
            CATEGORIES: '分类',
            TAGS: '标签',
            UNTITLED: '(未命名)',
        },
        ROOT_URL: '/',
        CONTENT_URL: '/content.json',
    };
    window.INSIGHT_CONFIG = INSIGHT_CONFIG;
})(window);
</script>

<script src="/js/insight.js"></script>






   
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>





   
    
  <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/valine"></script>
  <script type="text/javascript">
  var GUEST = ['nick', 'mail', 'link'];
  var meta = 'nick,mail,link';
  meta = meta.split(',').filter(function(item) {
    return GUEST.indexOf(item) > -1;
  });
  new Valine({
    el: '#vcomments',
    verify: false,
    notify: false,
    appId: 'SVT1dStIdP36PNVntBfpuIAa-gzGzoHsz',
    appKey: 'wXS1sNhJ0U7pxRdcjaxUCJIk',
    placeholder: '填写评论',
    avatar: 'mm',
    meta: meta,
    pageSize: '10' || 10,
    visitor: false
  });
  </script>

     







</body>
</html>